<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>班级列表</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <!--link导入外部的css，js样式，如果导入的资源和本页面在同一个文件夹下，直接文件名即可-->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- jQuery 3 -->
    <script th:src="@{/asserts/bower_components/jquery/dist/jquery.min.js}"></script>
    <!-- Bootstrap 3.3.7 -->
    <script th:src="@{/asserts/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- DataTables -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/AdminLTE.min.css}">
    <!--联想查询-->
    <script th:src="@{/asserts/Apolar_sh/lib/js/bigautocomplete.js}"></script>
    <link rel="stylesheet" th:href="@{/asserts/Apolar_sh/lib/css/bigautocomplete.css}" type="text/css"/>
    <script th:src="@{/asserts/Apolar_sh/lib/layer/2.4/layer.js}"></script>

    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        .search {
            margin-top: 40px;
            margin-left: 40px;
            position: relative;
        }

        td {
            text-align: center;
        }

        th {
            text-align: center;
        }
        #home {
            display: block;
            position: absolute;
            right: 10px;
            top: 8px;
            z-index: 9999;
            font-size: 30px;
        }

        #refresh {
            display: block;
            position: absolute;
            right: 46px;
            top: 10px;
            z-index: 9999;
            font-size: 26px;
        }
    </style>

</head>
<body>
<span>
    <a id="refresh" class="fa fa-refresh"  href="javascript:location.reload()"></a>
    <a id="home" class="fa fa-home" th:href="@{/career/findAll}"></a>
</span>


<div class="wrapper">
    <!-- Content Wrapper. Contains page content -->
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content-header">
        <h4>
            <i class="fa fa-search"></i> 搜索班级
        </h4>
    </section>

    <div class="search" style="margin-top: 15px;">

        <div class="row">
            <div class="col-xs-9">
                <!--				班级搜索表单-->
                <form class="form-inline" method="post" th:action="@{/career/searchClass}">
                    <div class="form-group">
                        <label>开班时间：</label>
                        <input type="date" class="form-control" name="startTime" id="classDate"
                               th:value="${#dates.format(classDate, 'yyyy-MM-dd')}" style="width: 130px;">
                    </div>

                    <div class="form-group">
                        <label>讲师：</label>
                        <input type="text" class="form-control" name="tName" id="classTeacher"
                               th:value="${classTeacher}" style="width: 130px;" placeholder="请输入讲师">
                    </div>

                    <div class="form-group">
                        <label>班主任：</label>
                        <input type="text" class="form-control" name="mName" id="classHeadTeacher"
                               th:value="${classHeadTeacher}" style="width: 130px;" placeholder="请输入班主任">
                    </div>

                    <div class="form-group">
                        <label>班级类型：</label>
                        <select id="classType" name="sName" class="form-control">
                            <option style="display: none;" th:value="${classType}" selected>--请选择班级类型--</option>
                            <option th:text="${classType}" th:value="${classType}" selected
                                    th:if="${classType != null}"></option>
                            <option value="Java">Java</option>
                            <option value="H5">H5</option>
                            <option value="IOS">IOS</option>
                            <option value="UIUE">UIUE</option>
                            <option value="Android">Android</option>
                            <option value="AI">AI</option>
                            <option value="GEM">GEM</option>
                            <option value=""></option>
                        </select>
                    </div>

                    <button type="submit" class="btn btn-success"><i class="fa fa-search"></i> 搜索</button>
                </form>
            </div>
        </div>
        <!-- /.row -->
    </div>

    <!-- /.content -->
</div>

<div class="wrapper">
    <!-- Content Wrapper. Contains page content -->
    <!-- Content Header (Page header) -->
    <section class="content-header" style="margin-top: -15px;">
        <h4>
            <i class="fa fa-navicon"></i>
            我的班级列表
        </h4>

    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <!-- /.box-header 部门列表的显示  table  表格  th/td单元个   th字体加粗，行标题-->
                    <div th:if="${info!=null}" class="box-body">[[${info}]]</div>
                    <div th:if="${info==null}" class="box-body">
                        <form id="form1" method="post" th:action="@{/career/export}">
                            <table id="example1" class="table table-bordered table-striped">
                                <tbody>
                                <tr>
                                    <th>选择</th>
                                    <th>班级名称</th>
                                    <th>讲师</th>
                                    <th>班主任</th>
                                    <th>班级类型</th>
                                    <th>开班时间</th>
                                    <th>成绩信息</th>
                                    <th>学生详情</th>
                                    <th>就业情况</th>
                                    <th>备注</th>
                                </tr>
                                <tr th:each="class:${pageBean.list}">
                                    <td th:if="${session.user.job != '企培'}">
                                        <input type="checkbox" id="check" name="classIds" class="checks" onchange="recordId(this)"
                                               th:value="${class.id}"/>
                                    </td>

                                    <td th:text="${class.cId}">PTC01-JD01190518</td>
                                    <td th:text="${class.tName}">章军</td>
                                    <td th:text="${class.mName}">班主任</td>
                                    <td th:text="${class.sName}">java</td>
                                    <td th:text="${#dates.format(class.startTime, 'yyyy-MM-dd')}">2019-07-22</td>
                                    <!--								<td th:text="${#dates.format(emp.birth, 'yyyy-MM-dd HH:mm')}"></td>-->
                                    <td>
                                        <a class="btn btn-info" th:onclick="scoreMessage([[${class.id}]],[[${searchUrl}]])">
                                            成绩信息
                                        </a>
                                    </td>
                                    <td>
                                        <a class="btn btn-info" th:onclick="stuDetils([[${class.id}]])">
                                            学生详情
                                        </a>
                                    </td>
                                    <td>
                                        <a class="btn btn-info"
                                           th:href="@{/career/class/job(careerClassId=${class.id},careerClassName=${class.cId})}">
                                            就业情况
                                        </a>
                                    </td>
                                    <td>
                                        <a class="btn btn-info " data-toggle="modal"
                                           th:data-target="${'#detilModal'+class.id}">
                                            <i class="fa fa-info"></i> 备注
                                        </a>
                                        <!-- 查看详情 Modal -->
                                        <div class="modal fade" th:id="${'detilModal'+class.id}"
                                             tabindex="-1" role="dialog"
                                             aria-labelledby="myModalLabel">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h4 class="modal-title" id="myModalLabel"
                                                            style="text-align: center;"><i class="fa fa-info"></i>&nbsp;&nbsp;备注
                                                        </h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <table class="table table-striped table-bordered">
                                                            <tbody>
                                                            <tr>
                                                                <td style="width: 30%;"><strong>备注:</strong></td>
                                                                <td style="word-break:break-all;"
                                                                    th:text="${class.ps}">
                                                                </td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                        <div>
                                                            <button type="button" class="btn btn-info btn-sm"
                                                                    data-dismiss="modal" style="margin: 0 0 0 85%;">关 闭
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- 查看详情 Modal -->
                                    </td>
                                </tr>
                                <tr th:if="${session.user.job != '企培'}">
                                    <td>
                                        <label><input type="checkbox" name="" id="all" value=""/>&nbsp;&nbsp;全选</label>
                                    </td>
                                    <td colspan="13" style="text-align:left;padding-left:20px;">
                                        <button class="btn btn-primary" type="submit">
                                            <i class="fa fa-download"></i> 导出到EXCEL
                                        </button>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>
                        <!-- 分页 -->
                        <nav aria-label="Page navigation">
                            <ul class="pagination">
                                <li>
                                    <a th:if="${pageBean.pageNum != 1 && searchUrl == null}"
                                       th:href="@{/career/findAll(currentPage=1,pageSize=${pageBean.pageSize})}">首页</a>
                                    <a th:if="${pageBean.pageNum != 1 && searchUrl != null}"
                                       th:href="@{${searchUrl}(tName=${classTeacher},startTime=${classDate},
									   mName=${classHeadTeacher},
									   sName=${classType},currentPage=1,pageSize=${pageBean.pageSize})}">首页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum==1 }"
                                       href="javascript:void(0)">首页</a>
                                </li>

                                <li th:if="${pageBean.pageNum!=1 && searchUrl == null }">
                                    <a th:href="@{/career/findAll(currentPage=${pageBean.pageNum-1},pageSize=${pageBean.pageSize})}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                                <li th:if="${pageBean.pageNum!=1 && searchUrl != null }">
                                    <a th:href="@{${searchUrl}(tName=${classTeacher},startTime=${classDate},
									   mName=${classHeadTeacher},
									   sName=${classType},currentPage=${pageBean.pageNum-1},pageSize=${pageBean.pageSize})}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                                <li class="disabled" th:if="${pageBean.pageNum==1 }">
                                    <a href="javascript:void(0)" aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>

                                <li th:classappend="${pageBean.pageNum==pageIndex}?'active':''"
                                    th:each="pageIndex:${pageValue}">
                                    <a
                                            th:if="${pageBean.pageNum==pageIndex}"
                                            th:text="${pageIndex}"></a>
                                    <a th:if="${pageIndex==-1}" style="cursor: default;opacity: 0.6;">
                                        ...
                                    </a>
                                    <a th:if="${pageBean.pageNum!=pageIndex&&pageIndex!=-1 && searchUrl == null }"
                                       th:href="@{/career/findAll(currentPage=${pageIndex},pageSize=${pageBean.pageSize})}"
                                       th:text="${pageIndex}"></a>
                                    <a th:if="${pageBean.pageNum!=pageIndex&&pageIndex!=-1 && searchUrl != null }"
                                       th:href="@{${searchUrl}(tName=${classTeacher},startTime=${classDate},
									   mName=${classHeadTeacher},
									   sName=${classType},currentPage=${pageIndex},pageSize=${pageBean.pageSize})}"
                                       th:text="${pageIndex}"></a>
                                </li>

                                <li class="disabled" th:if="${pageBean.pageNum==pageBean.pages }">
                                    <a href="javascript:void(0)" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                                <li th:if="${pageBean.pageNum!=pageBean.pages && searchUrl == null }">
                                    <a th:href="@{/career/findAll(currentPage=${pageBean.pageNum+1},pageSize=${pageBean.pageSize})}"
                                       aria-label="Next"> <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                                <li th:if="${pageBean.pageNum!=pageBean.pages && searchUrl != null}">
                                    <a th:href="@{${searchUrl}(tName=${classTeacher},startTime=${classDate},
									   mName=${classHeadTeacher},
									   sName=${classType},currentPage=${pageBean.pageNum+1},pageSize=${pageBean.pageSize})}"
                                       aria-label="Next"> <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>

                                <li>
                                    <a th:if="${pageBean.pageNum!=pageBean.pages && searchUrl == null}"
                                       th:href="@{/career/findAll(currentPage=${pageBean.pages},pageSize=${pageBean.pageSize})}">末页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum!=pageBean.pages && searchUrl != null }"
                                       th:href="@{${searchUrl}(tName=${classTeacher},startTime=${classDate},
									   mName=${classHeadTeacher},
									   sName=${classType},currentPage=${pageBean.pages},pageSize=${pageBean.pageSize})}">末页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum==pageBean.pages }"
                                       href="javascript:void(0)">末页</a>
                                </li>

                            </ul>
                        </nav>
                        <input id="currentPage" th:value="${pageBean.pageNum}" hidden>
                        <input id="currentPageSize" th:value="${pageBean.size}" hidden>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>

<!-- ./wrapper -->


<!-- DataTables -->
<script th:src="@{/asserts/bower_components/datatables.net/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/asserts/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js}"></script>
<!-- SlimScroll -->
<script th:src="@{/asserts/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<!-- FastClick -->
<script th:src="@{/asserts/bower_components/fastclick/lib/fastclick.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/asserts/dist/js/adminlte.min.js}"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/asserts/dist/js/demo.js}"></script>
<!-- page script -->
<!--联系查询-->
<script th:src="@{/asserts/Apolar_sh/lib/js/bigautocomplete.js}"></script>
<!-- page script -->

<script>

    // function changePage(searchUrl) {
    //     if (searchUrl != null && searchUrl.trim() != "") {
    //         window.location.href = '[[${#httpServletRequest.getContextPath()}]]' + searchUrl + '?classTeacher' + $("#classTeacher").val() + '&classHeadTeacher' + $("#classHeadTeacher").val() + '&classType' + $("#classType").val() + '&pageSize=' + $("#pageSize").val();
    //     } else {
    //         window.location.href = '[[${#httpServletRequest.getContextPath()}]]/career/findAll?pageSize=' + $("#pageSize").val();
    //     }
    // }

    $("#all").click(function () {
        if (this.checked) {
            $(".checks").prop("checked", true);
            $("#all").prop("value", "全不选");
        } else {
            $(".checks").prop("checked", false);
            $("#all").prop("value", "全选");
        }
    });

    //成绩信息
    function scoreMessage(classId,searchUrl) {
        var classDate = $("#classDate").val();
        var classTeacher = $("#classTeacher").val();
        var classHeadTeacher = $("#classHeadTeacher").val();
        var currentPage = $("#currentPage").val();
        var classType = $("#classType").val();
        if (searchUrl == null || searchUrl == "") {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/score/list?classId=" + classId + "&currentPage=" + currentPage;
        } else {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/score/list?classId=" + classId + "&classDate=" + classDate + "&tName=" + classTeacher + "&mName=" + classHeadTeacher + "&sName=" + classType + "&currentPage=" + currentPage;
        }
    }

    /*学生详情*/
    function stuDetils(classId) {
        var classDate = $("#classDate").val();
        var classTeacher = $("#classTeacher").val();
        var classHeadTeacher = $("#classHeadTeacher").val();
        var currentPageSize = $("#currentPageSize").val();
        var currentPage = $("#currentPage").val();
        var classType = $("#classType").val();
        if ((location.href).indexOf("searchClass") === -1) {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/stu/stuShow?classId=" + classId + "&currentPage=" + currentPage + "&currentPageSize=" + currentPageSize;
        } else {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/stu/stuShow?classId=" + classId + "&classDate=" + classDate + "&tName=" + classTeacher + "&mName=" + classHeadTeacher + "&sName=" + classType + "&currentPage=" + currentPage + "&currentPageSize=" + currentPageSize;
        }
    }
    var idArr = [];
    function recordId(obj) {
        if (idArr.length === 0 || obj.checked === true) {
            idArr.push(obj.value);
        } else {
            for (var index in idArr) {
                if (idArr[index] === obj.value) {
                    delete idArr[index];
                }
            }
        }
    }

    $("#form1").submit(function() {
        if (idArr.length < 1) {
            layer.msg('请勾选一个班级！', {icon: 0, time: 2000});
            return false;
        }else if (idArr.length > 1){
            layer.msg('请勾选一个班级！', {icon: 0, time: 2000});
            return false;
        } else {
            return true;
        }
    });
</script>


</body>
</html>